package com.uucrazy.googledoc.client.impl;

import api.wireless.gdata.client.AbstructParserFactory;
import api.wireless.gdata.client.ServiceDataClient;
import api.wireless.gdata.docs.client.DocsClient;
import api.wireless.gdata.docs.client.DocsGDataClient;
import api.wireless.gdata.docs.parser.xml.XmlDocsGDataParserFactory;
import api.wireless.gdata.util.AuthenticationException;

import com.uucrazy.googledoc.client.DocFace;
import com.uucrazy.googledoc.client.DocFactory;

public class DocClientFactory implements DocFactory {
	
	private String u;
	private String p;
	
	public DocClientFactory(String u,String p)
	{
		this.u = u;
		this.p = p;
	}
	
	@Override
	public DocFace getDocFace() throws AuthenticationException {
		DocsGDataClient dataclent = new DocsGDataClient("www.uucrazy.com",
				ServiceDataClient.DEFAULT_AUTH_PROTOCOL,
				ServiceDataClient.DEFAULT_HOST);
		DocsClient docsClient = new DocsClient(dataclent,new XmlDocsGDataParserFactory(new AbstructParserFactory()));
			docsClient.setUserCredentials(u, p); 
		return new DocFaceClient(docsClient);
	}
	
}
